home *** CD-ROM | disk | FTP | other *** search
Text File | 2005-02-07 | 49.4 KB | 1,748 lines |
- _global.krecordset = function()
- {
- this.filename = "xmlquery.php";
- };
- krecordset.prototype.setdatabridge = function(filename)
- {
- this.filename = filename;
- };
- krecordset.prototype.query = function(query)
- {
- this.records = new array();
- this.sqlxml = new xml();
- this.sqlxml._parent = this;
- this.sqlxml.ignorewhite = true;
- this.sqlxml.onload = function()
- {
- if(this.childnodes[0].nodename == "recordset")
- {
- var i = 0;
- while(i < this.childnodes[0].childnodes.length)
- {
- var record = this.childnodes[0].childnodes[i];
- var recordobject = new object();
- var j = 0;
- while(j < record.childnodes.length)
- {
- recordobject[record.childnodes[j].nodename] = record.childnodes[j].firstchild.nodevalue;
- j++;
- }
- this._parent.records.push(recordobject);
- i++;
- }
- this._parent.onqueried();
- }
- };
- this.sqlxml.load(this.filename + "?query=" + query);
- };
- op = object.prototype;
- op.$protect = function(pr)
- {
- if(arguments.length == 0)
- {
- pr = null;
- }
- assetpropflags(this,pr,7);
- };
- op.getpropertiesfrom = function(fo)
- {
- var pr;
- for(pr in "fo")
- {
- this[pr] = fo[pr];
- }
- };
- op.$protect();
- delete op;
- _global.kobject = function()
- {
- };
- kobject.__classes__ = [];
- kobject.registerclass = function(symbolid, theclass)
- {
- this.__classes__[symbolid] = theclass;
- };
- movieclip.prototype.kconvertmc = function(idname, initobject)
- {
- this.intervalid = "nop";
- this.getpropertiesfrom(initobject);
- this.__proto__ = kobject.__classes__[idname].prototype;
- kobject.__classes__[idname].apply(this);
- };
- movieclip.prototype.kattachmovie = function(idname, newname, depth, initobject)
- {
- this.createemptymovieclip(newname,depth);
- this[newname].kconvertmc(idname,initobject);
- };
- _global.kstyleformat = function(style)
- {
- var kss = style != null ? style.tolowercase() : _global.kstyleformat.style.tolowercase();
- var ks = [15790320,16777215,0,8421504,8421504,false,false,8421504,14211288,11579568,6316128,false,0,"verdana, helvetica",16777215,12];
- if(kss == "aqua")
- {
- ks = [16777215,14417919,2368682,2387455,4840277,true,true,2387455,14408703,2415615,2387455,true,0,"verdana, helvetica",16777215,12];
- }
- else if(kss == "desert")
- {
- ks = [16777130,16767914,2359296,7162112,11955456,true,false,7162112,14408533,14389760,7152640,true,0,"verdana, helvetica",16777215,12];
- }
- else if(kss == "invgreen")
- {
- ks = [9216,9216,2405888,11992917,46592,false,true,11992917,2368512,7180800,9633536,false,16777215,"verdana, helvetica",0,12];
- }
- else if(kss == "nature")
- {
- ks = [7143424,16777130,4793344,7143424,14380288,true,true,7143424,16767914,4840192,11946240,true,0,"verdana, helvetica",16777215,12];
- }
- this.arrow = ks[0];
- this.background = ks[1];
- this.border = ks[2];
- this.check = ks[3];
- this.face = ks[4];
- this.gradient = ks[5];
- this.liquid = ks[6];
- this.radiodot = ks[7];
- this.scrolltrack = ks[8];
- this.scrollbar = ks[9];
- this.selection = ks[10];
- this.shaded = ks[11];
- this.textcolor = ks[12];
- this.textfont = ks[13];
- this.textselected = ks[14];
- this.textsize = ks[15];
- };
- _global.kcomponent = function()
- {
- };
- kcomponent.prototype = new movieclip();
- kcomponent.prototype.usehandcursor = false;
- kcomponent.prototype.kdrawtbox = function(tl_x, tl_y, br_x, br_y)
- {
- this.clear();
- this.linestyle();
- this.beginfill(0,0);
- this.moveto(tl_x,tl_y);
- this.lineto(br_x,tl_y);
- this.lineto(br_x,br_y);
- this.lineto(tl_x,br_y);
- this.endfill();
- };
- kcomponent.prototype.kdrawliquidbox = function(tl_x, tl_y, br_x, br_y, cf)
- {
- this.clear();
- this.linestyle();
- var c1 = this.ksubcolor(cf,80,80,80);
- var c2 = this.ksubcolor(cf,24,24,24);
- if(this.pressing)
- {
- c2 = this.ksubcolor(c2,16,16,16);
- }
- else if(this.rover)
- {
- c2 = this.kaddcolor(c2,16,16,16);
- }
- var c3 = this.ksubcolor(cf,64,64,64);
- var colors = [c3,c2,c2,c1];
- var alphas = [100,100,100,100];
- var ratios = [0,128,175,255];
- var matrix = {matrixtype:"box",r:1.5700000524520874};
- matrix.w = br_x - tl_x;
- matrix.h = br_y - tl_y;
- matrix.x = 0;
- matrix.y = 0;
- this.begingradientfill("radial",colors,alphas,ratios,matrix);
- this.ksubrr(0,0,matrix.w,matrix.h);
- this.endfill();
- var colors = [16777215,16777215,16777215,16777215,cf,cf,cf];
- var alphas = [80,50,30,10,30,60,0];
- var ratios = [0,80,112,176,192,240,255];
- this.begingradientfill("linear",colors,alphas,ratios,matrix);
- this.ksubrr(1,1,matrix.w - 1,matrix.h - 1);
- this.endfill();
- };
- kcomponent.prototype.kdrawboxfilled = function(tl_x, tl_y, br_x, br_y, cf)
- {
- if(this.pressing)
- {
- cf = this.ksubcolor(cf,16,16,16);
- }
- else if(this.rover)
- {
- cf = this.kaddcolor(cf,16,16,16);
- }
- this.linestyle();
- this.moveto(tl_x,tl_y);
- if(this.style.gradient)
- {
- var colors = [this.kaddcolor(cf,32,32,32),this.ksubcolor(cf,32,32,32)];
- var alphas = [100,100];
- var ratios = [0,255];
- var matrix = {matrixtype:"box",r:1.2999999523162842};
- matrix.x = tl_x;
- matrix.y = tl_y;
- matrix.w = br_x - tl_x;
- matrix.h = br_y - tl_y;
- this.begingradientfill("linear",colors,alphas,ratios,matrix);
- }
- else
- {
- this.beginfill(cf);
- }
- this.lineto(br_x,tl_y);
- this.lineto(br_x,br_y);
- this.lineto(tl_x,br_y);
- this.endfill();
- };
- kcomponent.prototype.kdrawborderedboxfilled = function(tl_x, tl_y, br_x, br_y, cb, cf)
- {
- if(this.style.shaded)
- {
- var ctl = this.kaddcolor(cf,32,32,32);
- var cbr = this.ksubcolor(cf,32,32,32);
- if(this.pressing or this.style.sunken)
- {
- var tmp = ctl;
- ctl = cbr;
- cbr = tmp;
- }
- this.kdrawboxfilled(tl_x,tl_y,br_x,br_y,ctl);
- this.kdrawboxfilled(tl_x + 1,tl_y + 1,br_x,br_y,cbr);
- }
- else
- {
- this.kdrawboxfilled(tl_x,tl_y,br_x,br_y,cb);
- }
- this.kdrawboxfilled(tl_x + 1,tl_y + 1,br_x - 1,br_y - 1,cf);
- };
- kcomponent.prototype.kdrawcirclefilled = function(tl_x, tl_y, br_x, br_y, cf)
- {
- if(this.pressing)
- {
- cf = this.ksubcolor(cf,16,16,16);
- }
- else if(this.rover)
- {
- cf = this.kaddcolor(cf,16,16,16);
- }
- var mx = (tl_x + br_x) / 2;
- var my = (tl_y + br_y) / 2;
- var cx = (br_x - tl_x) * 0.02199999988079071;
- var cy = (br_y - tl_y) * 0.02199999988079071;
- this.linestyle();
- if(this.style.gradient)
- {
- var colors = [this.kaddcolor(cf,32,32,32),this.ksubcolor(cf,32,32,32)];
- var alphas = [100,100];
- var ratios = [0,255];
- var matrix = {matrixtype:"box",r:1.2999999523162842};
- matrix.x = tl_x;
- matrix.y = tl_y;
- matrix.w = br_x - tl_x;
- matrix.h = br_y - tl_y;
- this.begingradientfill("linear",colors,alphas,ratios,matrix);
- }
- else
- {
- this.beginfill(cf);
- }
- this.moveto(mx,tl_y);
- this.curveto(br_x - cx,tl_y + cy,br_x,my);
- this.curveto(br_x - cx,br_y - cy,mx,br_y);
- this.curveto(tl_x + cx,br_y - cy,tl_x,my);
- this.curveto(tl_x + cx,tl_y + cy,mx,tl_y);
- this.endfill();
- };
- kcomponent.prototype.kdrawborderedcirclefilled = function(tl_x, tl_y, br_x, br_y, cb, cf)
- {
- if(this.style.shaded)
- {
- var ctl = this.kaddcolor(cf,32,32,32);
- var cbr = this.ksubcolor(cf,32,32,32);
- if(this.pressing or this.style.sunken)
- {
- var tmp = ctl;
- ctl = cbr;
- cbr = tmp;
- }
- this.kdrawcirclefilled(tl_x,tl_y,br_x,br_y,ctl);
- this.kdrawcirclefilled(tl_x + 1,tl_y + 1,br_x,br_y,cbr);
- }
- else
- {
- this.kdrawcirclefilled(tl_x,tl_y,br_x,br_y,cb);
- }
- this.kdrawcirclefilled(tl_x + 1,tl_y + 1,br_x - 1,br_y - 1,cf);
- };
- kcomponent.prototype.kdrawcheckmark = function(tl_x, tl_y, br_x, br_y, cf)
- {
- this.linestyle();
- this.moveto(tl_x + 1,tl_y);
- this.beginfill(cf);
- this.lineto(br_x,br_y - 1);
- this.lineto(br_x - 1,br_y);
- this.lineto(tl_x,tl_y + 1);
- this.endfill();
- this.moveto(br_x - 1,tl_y);
- this.beginfill(cf);
- this.lineto(br_x,tl_y + 1);
- this.lineto(tl_x + 1,br_y);
- this.lineto(tl_x,br_y - 1);
- this.endfill();
- };
- kcomponent.prototype.kdrawborderedcirclefilled = function(tl_x, tl_y, br_x, br_y, cb, cf)
- {
- if(this.style.shaded)
- {
- var ctl = this.kaddcolor(cf,32,32,32);
- var cbr = this.ksubcolor(cf,32,32,32);
- if(this.pressing or this.style.sunken)
- {
- var tmp = ctl;
- ctl = cbr;
- cbr = tmp;
- }
- this.kdrawcirclefilled(tl_x,tl_y,br_x,br_y,ctl);
- this.kdrawcirclefilled(tl_x + 1,tl_y + 1,br_x,br_y,cbr);
- }
- else
- {
- this.kdrawcirclefilled(tl_x,tl_y,br_x,br_y,cb);
- }
- this.kdrawcirclefilled(tl_x + 1,tl_y + 1,br_x - 1,br_y - 1,cf);
- };
- kcomponent.prototype.kaddcolor = function(color, r, g, b)
- {
- var cb = math.min(255,color % 256 + b);
- var cg = 256 * math.min(255,math.floor(color / 256) % 256 + g);
- var cr = 65536 * math.min(255,math.floor(color / 65536) % 256 + r);
- return cr + cg + cb;
- };
- kcomponent.prototype.ksubcolor = function(color, r, g, b)
- {
- var cb = math.max(0,color % 256 - b);
- var cg = 256 * math.max(0,math.floor(color / 256) % 256 - g);
- var cr = 65536 * math.max(0,math.floor(color / 65536) % 256 - r);
- return cr + cg + cb;
- };
- kcomponent.prototype.ksubrr = function(tl_x, tl_y, br_x, br_y)
- {
- var r = 0.3499999940395355 * math.min(br_x - tl_x,br_y - tl_y);
- this.moveto(tl_x + r,tl_y);
- this.lineto(br_x - r,tl_y);
- this.curveto(br_x,tl_y,br_x,tl_y + r);
- this.lineto(br_x,br_y - r);
- this.curveto(br_x,br_y,br_x - r,br_y);
- this.lineto(tl_x + r,br_y);
- this.curveto(tl_x,br_y,tl_x,br_y - r);
- this.lineto(tl_x,tl_y + r);
- this.curveto(tl_x,tl_y,tl_x + r,tl_y);
- };
- textfield.prototype.getvisiblesize = function()
- {
- return this.bottomscroll - this.scroll + 1;
- };
- textfield.prototype.gettotalsize = function()
- {
- return this.bottomscroll - this.scroll + this.maxscroll;
- };
- kcomponent.prototype.kcinit = function()
- {
- this.style = new kstyleformat();
- };
- kcomponent.prototype.refresh = function()
- {
- if(this.intervalid == "nop")
- {
- this.intervalid = setinterval(this,"clearRefresh",20);
- }
- };
- kcomponent.prototype.clearrefresh = function()
- {
- if(this.intervalid != "nop")
- {
- clearinterval(this.intervalid);
- this.intervalid = "nop";
- }
- this.krefresh();
- };
- kcomponent.prototype.setlineheight = function()
- {
- this.createtextfield("test",777,0,0,0,0);
- var textformat = new textformat();
- textformat.font = this.style.textfont;
- textformat.size = this.style.textsize;
- this.test.setnewtextformat(textformat);
- this.test.text = " ";
- this.style.lineheight = this.test.textheight;
- this.test.removetextfield();
- };
- kcomponent.prototype.setsize = function(width, height)
- {
- this.width = width;
- this.height = height;
- this.refresh();
- };
- kcomponent.prototype.setwidth = function(width)
- {
- this.width = width;
- this.refresh();
- };
- kcomponent.prototype.getwidth = function()
- {
- return this.width;
- };
- kcomponent.prototype.setheight = function(height)
- {
- this.height = height;
- this.refresh();
- };
- kcomponent.prototype.getheight = function()
- {
- return this.height;
- };
- kcomponent.prototype.setstyle = function(styleformat, ischild)
- {
- this.style.getpropertiesfrom(styleformat);
- if(ischild != true)
- {
- this.setlineheight();
- }
- if(0 < this._children.length)
- {
- var s = 0;
- while(s < this._children.length)
- {
- this[this._children[s]].setstyle(this.style,true);
- s++;
- }
- }
- this.krefresh();
- };
- kcomponent.prototype.setstyleproperty = function(styleproperty, value)
- {
- this.style[styleproperty] = value;
- this.setstyle(this.style);
- };
- kcomponent.prototype.getstyleproperty = function(styleproperty)
- {
- return this.style[styleproperty];
- };
- kcomponent.prototype.setenabled = function(boolean)
- {
- this.enabled = boolean;
- if(0 < this._children.length)
- {
- var s = 0;
- while(s < this._children.length)
- {
- this[this._children[s]].setenabled(this.enabled);
- s++;
- }
- }
- };
- kcomponent.prototype.getenabled = function()
- {
- return this.enabled;
- };
- kcomponent.prototype.destroy = function()
- {
- this.removemovieclip();
- };
- _global.kdatacomponent = function()
- {
- };
- kdatacomponent.prototype = new kcomponent();
- kdatacomponent.prototype.kcinit = function()
- {
- this.style = new kstyleformat();
- this.itemlist = new array();
- this.itemid = 0;
- };
- kdatacomponent.prototype.additemat = function(index, label, value)
- {
- if(typeof value != "object")
- {
- var ko = new object();
- ko.value = value;
- }
- else
- {
- ko = value;
- }
- ko.label = label;
- ko._id = this.itemid;
- this.itemid += 1;
- this.itemlist.splice(index,0,ko);
- this.refresh();
- };
- kdatacomponent.prototype.additem = function(label, value)
- {
- this.additemat(this.itemlist.length,label,value);
- };
- kdatacomponent.prototype.removeitemat = function(index)
- {
- this.itemlist.splice(index,1);
- this.list.selected = null;
- this.refresh();
- };
- kdatacomponent.prototype.removeitemsbylabel = function(label, issubstring)
- {
- if(issubstring)
- {
- var i = this.itemlist.length - 1;
- while(i >= 0)
- {
- if(this.itemlist[i].label.indexof(label) + 1)
- {
- this.itemlist.splice(i,1);
- }
- i--;
- }
- }
- else
- {
- var i = this.itemlist.length - 1;
- while(i >= 0)
- {
- if(this.itemlist[i].label == label)
- {
- this.itemlist.splice(i,1);
- }
- i--;
- }
- }
- this.list.selected = null;
- this.refresh();
- };
- kdatacomponent.prototype.removeitemsbyvalue = function(value, issubstring)
- {
- if(issubstring)
- {
- var i = this.itemlist.length - 1;
- while(i >= 0)
- {
- if(typeof this.itemlist[i].value == "string" and this.itemlist[i].value.indexof(value) + 1)
- {
- this.itemlist.splice(i,1);
- }
- i--;
- }
- }
- else
- {
- var i = this.itemlist.length - 1;
- while(i >= 0)
- {
- if(this.itemlist[i].value == value)
- {
- this.itemlist.splice(i,1);
- }
- i--;
- }
- }
- this.list.selected = null;
- this.refresh();
- };
- kdatacomponent.prototype.removeall = function()
- {
- this.itemlist = new array();
- this.list.selected = null;
- this.refresh();
- };
- kdatacomponent.prototype.replaceitemat = function(index, label, value)
- {
- if(this.itemlist[index] != null)
- {
- if(typeof value != "object")
- {
- this.itemlist[index].value = value;
- }
- else
- {
- var tmpid = this.itemlist[index]._id;
- this.itemlist[index] = value;
- this.itemlist[index]._id = tmpid;
- }
- this.itemlist[index].label = label;
- }
- this.refresh();
- };
- kdatacomponent.prototype.getlength = function()
- {
- return this.itemlist.length;
- };
- kdatacomponent.prototype.getitemat = function(index)
- {
- return this.itemlist[index];
- };
- kdatacomponent.prototype.getitemlabel = function(index)
- {
- return this.itemlist[index].label;
- };
- kdatacomponent.prototype.getitemvalue = function(index)
- {
- return this.itemlist[index].value;
- };
- kdatacomponent.prototype.getitemid = function(index)
- {
- return this.itemlist[index]._id;
- };
- kdatacomponent.prototype.sortitemsbylabel = function(ascending)
- {
- this.itemlist.sorton("label");
- if(ascending == false)
- {
- this.itemlist.reverse();
- }
- this.refresh();
- };
- kdatacomponent.prototype.sortitemsbyvalue = function(ascending)
- {
- this.itemlist.sorton("value");
- if(ascending == false)
- {
- this.itemlist.reverse();
- }
- this.refresh();
- };
- _global.ksubarrow = function()
- {
- this.kcinit();
- this.krefresh();
- };
- ksubarrow.prototype = new kcomponent();
- ksubarrow.prototype.direction = "U";
- ksubarrow.prototype.size = 16;
- ksubarrow.prototype.krefresh = function()
- {
- var color = this.style.face;
- this.clear();
- if(this.style.liquid)
- {
- this.kdrawliquidbox(0,0,this.size,this.size,color);
- }
- else
- {
- this.kdrawborderedboxfilled(0,0,this.size,this.size,this.style.border,color);
- }
- var hw = this.size / 2;
- var m1 = this.size / 16 * 2.5;
- var m2 = this.size / 16 * 5.5;
- var kmangles = "LDR";
- var kmangle = 2 / 3 * math.pi;
- var angle = kmangles.indexof(this.direction.touppercase()) * math.pi / 2;
- this.beginfill(this.style.arrow);
- this.moveto(hw - math.cos(angle) * m1,hw + math.sin(angle) * m1);
- this.lineto(hw - math.cos(angle + kmangle) * m2,hw + math.sin(angle + kmangle) * m2);
- this.lineto(hw - math.cos(angle - kmangle) * m2,hw + math.sin(angle - kmangle) * m2);
- this.lineto(hw - math.cos(angle) * m1,hw + math.sin(angle) * m1);
- this.endfill();
- };
- ksubarrow.prototype.onpress = function()
- {
- if(this.pressing != true)
- {
- this.timer = getTimer();
- }
- this.pressing = true;
- this.krefresh();
- this.onclick();
- };
- ksubarrow.prototype.onrelease = function()
- {
- this.pressing = false;
- this.krefresh();
- };
- ksubarrow.prototype.onreleaseoutside = function()
- {
- this.pressing = false;
- this.krefresh();
- };
- ksubarrow.prototype.onrollover = function()
- {
- this.rover = true;
- this.krefresh();
- };
- ksubarrow.prototype.onrollout = function()
- {
- this.rover = false;
- this.krefresh();
- };
- kobject.registerclass("KSubArrow",ksubarrow);
- _global.kscrollbar = function()
- {
- this.kcinit();
- this.init();
- };
- kscrollbar.prototype = new kcomponent();
- kscrollbar.prototype.horizontal = false;
- kscrollbar.prototype.step = 1;
- kscrollbar.prototype.init = function()
- {
- this._visible = false;
- this.refresh = this.krefresh;
- this.createemptymovieclip("decrbar",3);
- this.createemptymovieclip("incrbar",4);
- this.decrbar.__proto__ = kcomponent.prototype;
- this.incrbar.__proto__ = kcomponent.prototype;
- this.decrbar.onpress = function()
- {
- var t = this._parent;
- t.object[t.controller] = math.max(t.minvalue,t.object[t.controller] - t.object[t.visiblesize] * (t.object[t.maxvalue] - t.minvalue) / (t.object[t.totalsize] - t.object[t.visiblesize]) + t.step);
- };
- this.incrbar.onpress = function()
- {
- var t = this._parent;
- t.object[t.controller] = math.min(t.object[t.maxvalue],t.object[t.controller] + t.object[t.visiblesize] * (t.object[t.maxvalue] - t.minvalue) / (t.object[t.totalsize] - t.object[t.visiblesize]) - t.step);
- };
- if(this.horizontal)
- {
- this.kattachmovie("KSubArrow","decrValue",1,{direction:"L",_y:2,_x:2});
- this.decrbar._x = 20;
- this.decrbar._y = 0;
- }
- else
- {
- this.kattachmovie("KSubArrow","decrValue",1,{direction:"U",_x:2,_y:2});
- this.decrbar._x = 0;
- this.decrbar._y = 20;
- }
- this.decrvalue.onclick = function()
- {
- var t = this._parent;
- t.object[t.controller] = math.max(t.minvalue,t.object[t.controller] - t.step);
- this.onenterframe = function()
- {
- if(!this.pressing)
- {
- this.onenterframe = null;
- }
- else if(this.timer + 500 < getTimer())
- {
- this.onpress();
- }
- };
- this._parent.refresh();
- };
- if(this.horizontal)
- {
- this.kattachmovie("KSubArrow","incrValue",2,{direction:"R",_y:2,_x:this.object._width - 18});
- this.incrbar._y = 0;
- }
- else
- {
- this.kattachmovie("KSubArrow","incrValue",2,{direction:"D",_x:2,_y:this.object._height - 18});
- this.incrbar._x = 0;
- }
- this.incrvalue.onclick = function()
- {
- var t = this._parent;
- t.object[t.controller] = math.min(t.object[t.maxvalue],t.object[t.controller] + t.step);
- this.onenterframe = function()
- {
- if(!this.pressing)
- {
- delete this.onenterframe;
- }
- else if(this.timer + 500 < getTimer())
- {
- this.onpress();
- }
- };
- this._parent.refresh();
- };
- this._children = ["incrValue","decrValue","scrollBar"];
- this.createemptymovieclip("scrollbar",5);
- this.scrollbar.__proto__ = kcomponent.prototype;
- this.scrollbar._x = 2;
- this.scrollbar._y = 2;
- if(this.horizontal)
- {
- this.scrollbar.onpress = function()
- {
- this.startdrag(false,20,2,this._parent.object._width - this._width - 18,2);
- this.dragging = true;
- };
- }
- else
- {
- this.scrollbar.onpress = function()
- {
- this.startdrag(false,2,20,2,this._parent.object._height - this._height - 18);
- this.dragging = true;
- };
- }
- this.scrollbar.onrelease = function()
- {
- this.stopdrag();
- this.dragging = false;
- this._parent.kbarrefresh();
- };
- this.scrollbar.onreleaseoutside = function()
- {
- this.stopdrag();
- this.dragging = false;
- this._parent.kbarrefresh();
- };
- this.scrollbar.onmousemove = function()
- {
- var t = this._parent;
- if(this.dragging and t.object[t.maxvalue] != t.minvalue)
- {
- if(t.horizontal)
- {
- var barspace = t.object._width - this._width - 38;
- t.object[t.controller] = math.min(t.object[t.maxvalue],math.floor((this._x - 20) / (barspace / math.max(1,t.object[t.maxvalue] - t.minvalue + 1))) + t.minvalue);
- }
- else
- {
- var barspace = t.object._height - this._height - 38;
- t.object[t.controller] = math.min(t.object[t.maxvalue],math.floor((this._y - 20) / (barspace / math.max(1,t.object[t.maxvalue] - t.minvalue + 1))) + t.minvalue);
- }
- }
- };
- this.scrollcheck = function()
- {
- if(!this.hidden)
- {
- var object = this.object;
- var visible = object._visible;
- var controller = object[this.controller];
- var minvalue = this.minvalue;
- var maxvalue = object[this.maxvalue];
- var visiblesize = object[this.visiblesize];
- var totalsize = object[this.totalsize];
- var eventcheck = "/" + visible + "/" + controller + "/" + minvalue + "/" + maxvalue + "/" + visiblesize + "/" + totalsize;
- if(object.eventcheck != eventcheck)
- {
- object.eventcheck = eventcheck;
- this.krefresh();
- }
- }
- };
- setinterval(this,"scrollCheck",200);
- };
- kscrollbar.prototype.hide = function(hide)
- {
- if(this.hidden != hide)
- {
- this.hidden = hide;
- if(hide)
- {
- this._visible = false;
- }
- else
- {
- this.krefresh();
- }
- }
- };
- kscrollbar.prototype.kbarrefresh = function()
- {
- if(this.horizontal)
- {
- this.incrbar._x = this._width - 22;
- this.incrbar.kdrawtbox(this.scrollbar._x + this.scrollbar._width - 2 - this.incrbar._x,0,0,20);
- this.decrbar.kdrawtbox(0,0,this.scrollbar._x - 20,20);
- }
- else
- {
- this.incrbar._y = this._height - 22;
- this.incrbar.kdrawtbox(0,this.scrollbar._y + this.scrollbar._height - 2 - this.incrbar._y,20,0);
- this.decrbar.kdrawtbox(0,0,20,this.scrollbar._y - 20);
- }
- };
- kscrollbar.prototype.krefresh = function()
- {
- if(!this.hidden)
- {
- if(!this.scrollbar.dragging)
- {
- var object = this.object;
- var controller = this.controller;
- var minvalue = this.minvalue;
- var maxvalue = this.maxvalue;
- var visiblesize = object[this.visiblesize];
- var totalsize = object[this.totalsize];
- if(this.horizontal)
- {
- var barsize = (object._width - 40) * math.min(visiblesize / totalsize,1);
- if(barsize < 4)
- {
- barsize = 4;
- }
- var barspace = object._width - barsize - 40;
- this._x = object._x;
- this._y = object._y + object._height;
- this.incrvalue._x = object._width - 18;
- this.clear();
- this.kdrawborderedboxfilled(0,0,object._width,20,this.style.border,this.style.scrolltrack);
- this.scrollbar.clear();
- this.scrollbar.style = this.style;
- if(this.style.liquid)
- {
- this.scrollbar.kdrawliquidbox(0,0,barsize,16,this.style.scrollbar);
- }
- else
- {
- this.scrollbar.kdrawborderedboxfilled(0,0,barsize,16,this.style.border,this.style.scrollbar);
- }
- this.scrollbar._x = 20 + (object[controller] - minvalue) * barspace / math.max(1,object[maxvalue] - minvalue);
- this.kbarrefresh();
- }
- else
- {
- var barsize = (object._height - 40) * math.min(visiblesize / totalsize,1);
- if(barsize < 4)
- {
- barsize = 4;
- }
- var barspace = object._height - barsize - 40;
- this._x = object._x + object._width;
- this._y = object._y;
- this.incrvalue._y = object._height - 18;
- this.clear();
- this.kdrawborderedboxfilled(0,0,20,object._height,this.style.border,this.style.scrolltrack);
- this.scrollbar.clear();
- this.scrollbar.style = this.style;
- if(this.style.liquid)
- {
- this.scrollbar.kdrawliquidbox(0,0,16,barsize,this.style.scrollbar);
- }
- else
- {
- this.scrollbar.kdrawborderedboxfilled(0,0,16,barsize,this.style.border,this.style.scrollbar);
- }
- this.scrollbar._y = 20 + (object[controller] - minvalue) * barspace / math.max(1,object[maxvalue] - minvalue);
- this.kbarrefresh();
- }
- this._visible = object._visible;
- }
- }
- };
- kscrollbar.prototype.reassign = function(object, controller, minvalue, maxvalue, visiblesize, totalsize, horizontal)
- {
- this.object = eval(object);
- this.controller = controller;
- this.minvalue = minvalue;
- this.maxvalue = maxvalue;
- this.visiblesize = visiblesize;
- this.totalsize = totalsize;
- this.horizontal = horizontal;
- this.krefresh();
- };
- kscrollbar.prototype.reassigntextfield = function(textfield, horizontal)
- {
- if(horizontal)
- {
- this.reassign(textfield,"hscroll",0,"maxhscroll","_width","textWidth",true);
- this.step = 10;
- }
- else
- {
- this.reassign(textfield,"scroll",1,"maxscroll","visibleSize","totalSize");
- this.step = 1;
- }
- };
- kobject.registerclass("KScrollBar",kscrollbar);
- _global.kcheckbox = function()
- {
- this.kcinit();
- this.init();
- };
- kcheckbox.prototype = new kcomponent();
- kcheckbox.prototype.width = 12;
- kcheckbox.prototype.init = function()
- {
- this.style.sunken = true;
- this.createtextfield("label",1,0,0,0,0);
- this.label.autosize = "left";
- this.label.selectable = false;
- this.label.multiline = false;
- this.checked = false;
- this.createemptymovieclip("check",3);
- this.check.__proto__ = kcomponent.prototype;
- this.check.onpress = function()
- {
- this._parent.checked = !this._parent.checked;
- this._parent.refresh();
- this._parent.onchange();
- };
- this.krefresh();
- };
- kcheckbox.prototype.krefresh = function()
- {
- this.check.clear();
- this.check.style = this.style;
- if(this.rightplacement)
- {
- this.check.kdrawborderedboxfilled(- this.width,0,0,this.width,this.style.border,this.style.background);
- if(this.checked)
- {
- this.check.kdrawcheckmark(2 - this.width,2,- 2,this.width - 2,this.style.check);
- }
- }
- else
- {
- this.check.kdrawborderedboxfilled(0,0,this.width,this.width,this.style.border,this.style.background);
- if(this.checked)
- {
- this.check.kdrawcheckmark(2,2,this.width - 2,this.width - 2,this.style.check);
- }
- }
- this.setlabel(this.label.text);
- };
- kcheckbox.prototype.setlabel = function(label)
- {
- var textformat = new textformat();
- textformat.color = this.style.textcolor;
- textformat.font = this.style.textfont;
- textformat.size = this.style.textsize;
- this.label.setnewtextformat(textformat);
- this.label.text = label;
- this.label._y = this.width - this.label.textheight;
- if(this.rightplacement)
- {
- this.label._x = - this.width - 8 - this.label.textwidth;
- }
- else
- {
- this.label._x = this.width + 4;
- }
- };
- kcheckbox.prototype.setlabelplacement = function(placement)
- {
- if(placement.tolowercase() == "right")
- {
- this.rightplacement = true;
- }
- else
- {
- this.rightplacement = false;
- }
- this.krefresh();
- };
- kcheckbox.prototype.getlabel = function()
- {
- return this.label.text;
- };
- kcheckbox.prototype.setvalue = function(boolean)
- {
- var change = this.checked != boolean;
- this.checked = boolean;
- this.refresh();
- if(change)
- {
- this.onchange();
- }
- };
- kcheckbox.prototype.getvalue = function()
- {
- return this.checked;
- };
- kobject.registerclass("KCheckBox",kcheckbox);
- _global.ksublist = function()
- {
- this.kcinit();
- this.init();
- };
- ksublist.prototype = new kcomponent();
- ksublist.prototype.setscrollposition = function(scrollposition)
- {
- this.topitem = scrollposition;
- this.refresh();
- };
- ksublist.prototype.getscrollposition = function()
- {
- return this.topitem;
- };
- ksublist.prototype.getmaxscroll = function()
- {
- return math.max(0,this._parent.getlength() - this.size);
- };
- ksublist.prototype.setrowcount = function(size)
- {
- this.size = size;
- this.refresh();
- };
- ksublist.prototype.getrowcount = function()
- {
- return this.size;
- };
- ksublist.prototype.getlength = function()
- {
- return this._parent.getlength();
- };
- ksublist.prototype.init = function()
- {
- this.setlineheight();
- this.topitem = 0;
- this.createemptymovieclip("hb",1);
- this.hb.__proto__ = kcomponent.prototype;
- this.hb._alpha = 15;
- this.createtextfield("display",2,2,0,0,0);
- this.display.html = true;
- this.display.selectable = false;
- this.display.multiline = true;
- this.addproperty("scroll",this.getscrollposition,this.setscrollposition);
- this.addproperty("maxscroll",this.getmaxscroll,null);
- this.addproperty("rowcount",this.getrowcount,null);
- this.addproperty("length",this.getlength,null);
- this.addproperty("_height",this.getheight,null);
- this.addproperty("_width",this.getwidth,null);
- };
- ksublist.prototype.onrollover = function()
- {
- this.hb.y = null;
- this.onmousemove = this.mousemover;
- };
- ksublist.prototype.mousemover = function()
- {
- var point = new object();
- point.x = _root._xmouse;
- point.y = _root._ymouse;
- this.globaltolocal(point);
- var lineheight = this.style.lineheight + 2;
- var i = this.topitem + math.floor((point.y - 2) / lineheight);
- var y = (i - this.topitem) * lineheight;
- if(y != this.hb.y)
- {
- this.hb.y = y;
- this.hb.clear();
- if(i >= this.topitem and i < this.topitem + this.size and i < this.getlength())
- {
- this.hb.kdrawboxfilled(2,2 + y,this.width - 1,lineheight + y + 1,!!this._parent.itemlist[i].selected ? this.style.background : this.style.selection);
- this._tooltip = this._parent.itemlist[i]._tooltip;
- }
- }
- };
- ksublist.prototype.onrollout = function()
- {
- this.onmousemove = null;
- this.hb.clear();
- };
- ksublist.prototype.onpress = function()
- {
- var point = new object();
- point.x = _root._xmouse;
- point.y = _root._ymouse;
- this.globaltolocal(point);
- var i = this.topitem + math.floor((point.y - 2) / (this.style.lineheight + 2));
- if(i >= this.topitem and i < this.topitem + this.size and i < this.getlength())
- {
- if(!this.multiple)
- {
- if(this.selected != i)
- {
- this._parent.itemlist[this.selected].selected = false;
- this.selected = i;
- this._parent.itemlist[this.selected].selected = true;
- this.refresh();
- this._parent.onchange();
- }
- }
- else
- {
- this._parent.itemlist[i].selected = !this._parent.itemlist[i].selected;
- this.refresh();
- this._parent.onchange();
- }
- }
- };
- ksublist.prototype.khtmlcolor = function(color)
- {
- if(typeof color == "number")
- {
- return "#" + color.tostring(16);
- }
- return "#" + color.substr(color.indexof("x") + 1);
- };
- ksublist.prototype.krefresh = function()
- {
- if(this._parent.width < 40)
- {
- this._parent.width = 40;
- }
- this.size = math.max(this.size,math.ceil(47 / (this.style.lineheight + 2)));
- if(this.autohide and this.size >= this.getlength())
- {
- this.width = this._parent.width;
- this._parent.vscroller.hide(true);
- }
- else
- {
- this.width = this._parent.width - 20;
- this._parent.vscroller.hide(false);
- }
- var html = "<TEXTFORMAT LEADING=\"2\"><FONT FACE=\"" + this._parent.style.textfont + "\" SIZE=\"" + this._parent.style.textsize + "\">";
- var i = this.topitem;
- while(i < this.topitem + this.size)
- {
- html += "<FONT COLOR=\"" + this.khtmlcolor(!!this._parent.itemlist[i].selected ? this.style.textselected : this.style.textcolor) + "\">";
- var label = this._parent.getitemlabel(i);
- if(typeof label == "undefined")
- {
- label = "";
- }
- html += label + "</FONT><BR>";
- i++;
- }
- html += "</FONT></TEXTFORMAT>";
- this.display.htmltext = html;
- this.display._width = this.width - 1;
- var lineheight = this.style.lineheight + 2;
- this.height = this.size * lineheight + 3;
- this.display._height = this.height;
- this.kdrawborderedboxfilled(0,0,this.width,this.height,this.style.border,this.style.background);
- if(this._parent.vscroller.hidden)
- {
- var i = 0;
- while(i < this.size)
- {
- if(this._parent.itemlist[this.topitem + i].selected)
- {
- this.kdrawborderedboxfilled(2,i * lineheight + 2,this.width - 2,(i + 1) * lineheight + 1,this.style.border,this.style.selection);
- }
- i++;
- }
- }
- else
- {
- this.kdrawboxfilled(1,1,this.width,this.height - 1,this.style.background);
- var i = 0;
- while(i < this.size)
- {
- if(this._parent.itemlist[this.topitem + i].selected)
- {
- this.kdrawborderedboxfilled(2,i * lineheight + 2,this.width - 1,(i + 1) * lineheight + 1,this.style.border,this.style.selection);
- }
- i++;
- }
- }
- this._parent.vscroller.clearrefresh();
- };
- kobject.registerclass("KSubList",ksublist);
- _global.klistbox = function()
- {
- this.kcinit();
- this.init();
- };
- klistbox.prototype = new kdatacomponent();
- klistbox.prototype.getvalue = function()
- {
- var i = this.getselecteditem();
- if(typeof i.value != "undefined")
- {
- return i.value;
- }
- return i.label;
- };
- klistbox.prototype.getselectedindex = function()
- {
- if(!this.list.multiple)
- {
- return this.list.selected;
- }
- return this.getselectedindices()[0];
- };
- klistbox.prototype.getselectedindices = function()
- {
- var selected = new array();
- var i = 0;
- while(i < this.itemlist.length)
- {
- if(this.itemlist[i].selected)
- {
- selected.push(i);
- }
- i++;
- }
- return selected;
- };
- klistbox.prototype.getselecteditem = function()
- {
- if(!this.list.multiple)
- {
- return this.itemlist[this.list.selected];
- }
- return this.getselecteditems()[0];
- };
- klistbox.prototype.setselectedindex = function(i)
- {
- if(i < this.getlength())
- {
- this.itemlist[this.list.selected].selected = false;
- this.itemlist[i].selected = true;
- this.list.selected = i;
- this.list.refresh();
- this.onchange();
- }
- };
- klistbox.prototype.getselecteditems = function()
- {
- var selected = new array();
- var i = 0;
- while(i < this.itemlist.length)
- {
- if(this.itemlist[i].selected)
- {
- selected.push(this.itemlist[i]);
- }
- i++;
- }
- return selected;
- };
- klistbox.prototype.setselectedindices = function(itemarray)
- {
- this.setselectmultiple(true);
- var i = 0;
- while(i < itemarray.length)
- {
- if(itemarray[i] < this.itemlist.length)
- {
- this.itemlist[itemarray[i]].selected = true;
- }
- i++;
- }
- this.list.refresh();
- this.onchange();
- };
- klistbox.prototype.setscrollposition = function(scrollposition)
- {
- this.list.setscrollposition(scrollposition);
- };
- klistbox.prototype.getscrollposition = function()
- {
- return this.list.getscrollposition();
- };
- klistbox.prototype.setselectmultiple = function(multiple)
- {
- this.list.multiple = multiple;
- if(!multiple)
- {
- var i = 0;
- while(i < this.itemlist.length)
- {
- this.itemlist[i].selected = false;
- i++;
- }
- }
- };
- klistbox.prototype.getselectmultiple = function()
- {
- return this.list.multiple;
- };
- klistbox.prototype.setrowcount = function(size)
- {
- this.list.setrowcount(size);
- };
- klistbox.prototype.getrowcount = function()
- {
- return this.list.getrowcount();
- };
- klistbox.prototype.setautohidescrollbar = function(autohide)
- {
- this.list.autohide = autohide;
- };
- klistbox.prototype.init = function()
- {
- this.selectedarray = [];
- this.kattachmovie("KSubList","list",1);
- this.kattachmovie("KScrollBar","vScroller",2,{object:eval(this.list),controller:"scroll",minvalue:0,maxvalue:"maxscroll",visiblesize:"rowcount",totalsize:"length"});
- this.vscroller.onenterframe = null;
- this._children = ["list","vScroller"];
- this.list.size = this.rowcount;
- this.krefresh();
- };
- klistbox.prototype.krefresh = function()
- {
- this.list.refresh();
- };
- kobject.registerclass("KListBox",klistbox);
- _global.ksubpane = function()
- {
- this.kcinit();
- this.init();
- };
- ksubpane.prototype = new kcomponent();
- ksubpane.prototype.init = function()
- {
- this.createemptymovieclip("content",1);
- this.content.__proto__ = kcomponent.prototype;
- this.createemptymovieclip("mask",2);
- this.mask.__proto__ = kcomponent.prototype;
- this.mask._visible = false;
- this.content.setmask(this.mask);
- this.children = ["content"];
- this.krefresh();
- this.addproperty("_height",this.getheight,null);
- this.addproperty("_width",this.getwidth,null);
- this.addproperty("vscroll",this.getvscroll,this.setvscroll);
- this.addproperty("hscroll",this.gethscroll,this.sethscroll);
- this.addproperty("maxvscroll",this.getmaxvscroll,null);
- this.addproperty("maxhscroll",this.getmaxhscroll,null);
- this.addproperty("contentheight",this.getcontentheight,null);
- this.addproperty("contentwidth",this.getcontentwidth,null);
- };
- ksubpane.prototype.krefresh = function()
- {
- this.clear();
- mask.clear();
- this.kdrawborderedboxfilled(0,0,this.width,this.height,this.style.border,this.style.scrolltrack);
- this.kdrawboxfilled(1,1,this.width,this.height,this.style.background);
- this.mask.kdrawboxfilled(1,1,this.width,this.height,0);
- };
- ksubpane.prototype.loadcontent = function(filename, hs, vs)
- {
- this.hs = hs;
- this.vs = vs;
- delete this.content;
- delete this.loadbar;
- this.createemptymovieclip("content",1);
- this.content.__proto__ = kcomponent.prototype;
- this.createemptymovieclip("loadbar",7);
- this.loadbar.__proto__ = kcomponent.prototype;
- this.loadbar.style = this.style;
- this.loadbar.kdrawborderedboxfilled(this.width * 0.20000000298023224,this.height * 0.4000000059604645,this.width * 0.800000011920929,this.height * 0.6000000238418579,this.style.border,this.style.scrolltrack);
- this.loadbar.kdrawborderedboxfilled(2 + this.width * 0.20000000298023224,2 + this.height * 0.4000000059604645,6 + this.width * 0.20000000298023224,this.height * 0.6000000238418579 - 2,this.style.border,this.style.scrolltrack);
- this.content.loadmovie(filename);
- this.onenterframe = function()
- {
- if(0 < this.content._width * this.content._height)
- {
- if(0 < this.hs)
- {
- this.hscroll = this.hs;
- }
- if(0 < this.vs)
- {
- this.vscroll = this.vs;
- }
- this.onenterframe = null;
- this.loadbar.removemovieclip();
- this.content.setmask(this.mask);
- this.content.enabled = this.enabled;
- if(this._parent.allowdragging)
- {
- this.content.onpress = function()
- {
- this.startdrag(false,0,0,- this._parent.getmaxhscroll(),- this._parent.getmaxvscroll());
- this.dragging = true;
- };
- this.content.onrelease = function()
- {
- this.dragging = false;
- this.stopdrag();
- };
- this.content.onreleaseoutside = function()
- {
- this.dragging = false;
- this.stopdrag();
- };
- }
- this.clearrefresh();
- }
- else
- {
- var lcw = this.content.getbytesloaded();
- if(0 < lcw)
- {
- lcw = (this.width * 0.6000000238418579 - 8) * lcw / this.content.getbytestotal();
- if(lcw != this.lcw)
- {
- this.loadbar.kdrawborderedboxfilled(2 + this.width * 0.20000000298023224,2 + this.height * 0.4000000059604645,6 + this.width * 0.20000000298023224 + lcw,this.height * 0.6000000238418579 - 2,this.style.border,this.style.scrolltrack);
- this.lcw = lcw;
- }
- }
- }
- };
- this.refresh();
- };
- ksubpane.prototype.setvscroll = function(vscroll)
- {
- this._vscroll = vscroll;
- this.content._y = - vscroll;
- };
- ksubpane.prototype.getvscroll = function()
- {
- this._vscroll = - this.content._y;
- return this._vscroll;
- };
- ksubpane.prototype.sethscroll = function(hscroll)
- {
- this._hscroll = hscroll;
- this.content._x = - hscroll;
- };
- ksubpane.prototype.gethscroll = function()
- {
- this._hscroll = - this.content._x;
- return this._hscroll;
- };
- ksubpane.prototype.getmaxvscroll = function()
- {
- return math.max(0,this.content._height - this.height);
- };
- ksubpane.prototype.getmaxhscroll = function()
- {
- return math.max(0,this.content._width - this.width);
- };
- ksubpane.prototype.getcontentheight = function()
- {
- return this.content._height;
- };
- ksubpane.prototype.getcontentwidth = function()
- {
- return this.content._width;
- };
- kobject.registerclass("KSubPane",ksubpane);
- _global.kscrollpane = function()
- {
- this.kcinit();
- this.init();
- };
- kscrollpane.prototype = new kcomponent();
- kscrollpane.prototype.allowdragging = false;
- kscrollpane.prototype.init = function()
- {
- if(this.width < 65)
- {
- this.width = 65;
- }
- if(this.height < 65)
- {
- this.height = 65;
- }
- this.kattachmovie("KSubPane","pane",1,{width:this.width - 20,height:this.height - 20,_x:0,_y:0});
- this.kattachmovie("KScrollBar","vScroller",2,{object:eval(this.pane),controller:"vscroll",minvalue:0,maxvalue:"maxvscroll",visiblesize:"_height",totalsize:"contentheight",horizontal:false,step:10});
- this.kattachmovie("KScrollBar","hScroller",3,{object:eval(this.pane),controller:"hscroll",minvalue:0,maxvalue:"maxhscroll",visiblesize:"_width",totalsize:"contentwidth",horizontal:true,step:10});
- this._children = ["pane","vScroller","hScroller"];
- this.content = this.pane.content;
- this.krefresh();
- };
- kscrollpane.prototype.krefresh = function()
- {
- if(this.width < 65)
- {
- this.width = 65;
- }
- if(this.height < 65)
- {
- this.height = 65;
- }
- this.clear();
- this.kdrawborderedboxfilled(0,0,this.width,this.height,this.style.border,this.style.scrolltrack);
- this.pane.setsize(this.width - 20,this.height - 20);
- };
- kscrollpane.prototype.loadcontent = function(filename, hs, vs)
- {
- this.pane.loadcontent(filename,hs,vs);
- };
- kobject.registerclass("KScrollPane",kscrollpane);
- _global.kpushbutton = function()
- {
- this.kcinit();
- this.init();
- };
- kpushbutton.prototype = new kcomponent();
- kpushbutton.prototype.init = function()
- {
- this.createtextfield("label",1,0,0,0,0);
- this.label.autosize = "left";
- this.label.selectable = false;
- this.label.multiline = false;
- this.refresh();
- };
- kpushbutton.prototype.onpress = function()
- {
- this.pressing = true;
- this.refresh();
- this.onclick();
- };
- kpushbutton.prototype.onrelease = function()
- {
- this.pressing = false;
- this.refresh();
- };
- kpushbutton.prototype.onreleaseoutside = function()
- {
- this.pressing = false;
- this.refresh();
- };
- kpushbutton.prototype.onrollover = function()
- {
- this.rover = true;
- this.refresh();
- };
- kpushbutton.prototype.onrollout = function()
- {
- this.rover = false;
- this.refresh();
- };
- kpushbutton.prototype.krefresh = function()
- {
- var color = this.style.face;
- this.clear();
- if(this.style.liquid)
- {
- this.kdrawliquidbox(0,0,this.width,this.height,color);
- }
- else
- {
- this.kdrawborderedboxfilled(0,0,this.width,this.height,this.style.border,color);
- }
- this.setlabel(this.label.text);
- };
- kpushbutton.prototype.setautoresize = function(boolean)
- {
- this.buttonresize = boolean;
- };
- kpushbutton.prototype.setlabel = function(label)
- {
- var textformat = new textformat();
- textformat.color = this.style.textcolor;
- textformat.font = this.style.textfont;
- textformat.size = this.style.textsize;
- this.label.setnewtextformat(textformat);
- this.label.text = label;
- this.label._x = this.width / 2 - this.label.textwidth / 2 - 2;
- this.label._y = this.height / 2 - this.label.textheight / 2 - 2;
- if(this.buttonresize)
- {
- this.setsize(this.label.textwidth + 10,this.label.textheight + 10);
- }
- };
- kpushbutton.prototype.getlabel = function()
- {
- return this.label.text;
- };
- kobject.registerclass("KPushButton",kpushbutton);
- ko = _global.ktooltip = object.ktooltip = new object();
- ko.iid = "nop";
- ko.style = new kstyleformat();
- ko.setstyle = function(styleformat)
- {
- this.style.getpropertiesfrom(styleformat);
- };
- ko.setstyleproperty = function(styleproperty, value)
- {
- this.style[styleproperty] = value;
- };
- ko.cleartip = function()
- {
- clearinterval(this.iid);
- this.iid = "nop";
- _root.ktooltiptf.removetextfield();
- };
- ko.checktip = function()
- {
- clearinterval(this.iid);
- this.iid = setinterval(this,"clearTip",5500);
- var mc = _root;
- var tip = mc._tooltip;
- var eoc = false;
- while(!eoc)
- {
- var cnt = true;
- var smc = mc;
- var p;
- for(p in "smc")
- {
- if(cnt and smc[p]._parent == smc and smc[p].hittest(_root._xmouse,_root._ymouse,true))
- {
- mc = mc[p];
- cnt = false;
- if(mc._tooltip.length)
- {
- tip = mc._tooltip;
- }
- }
- }
- if(cnt == true)
- {
- eoc = true;
- }
- }
- if(tip.length)
- {
- var d = 16384;
- var i;
- for(i in "_root")
- {
- if(this[i].getdepth() != null)
- {
- d = math.max(d,this[i].getdepth());
- }
- }
- d++;
- _root.createtextfield("KToolTipTF",d,0,0,0,0);
- var k = _root.ktooltiptf;
- var s = this.style;
- var f = new textformat();
- f.font = s.textfont;
- f.size = s.textsize;
- f.color = s.textcolor;
- k.setnewtextformat(f);
- k.text = tip;
- k._x = _root._xmouse;
- k._x = math.min(stage.width - k.textwidth - 8,k._x);
- k._y = _root._ymouse + 22;
- if(stage.height < k._y + k.textheight + 6)
- {
- k._y = _root._ymouse - k.textheight - 6;
- }
- k.autosize = "left";
- k.background = true;
- k.border = true;
- k.selectable = false;
- k.backgroundcolor = s.background;
- k.bordercolor = s.border;
- }
- };
- ko.activate = function()
- {
- this.onmousemove = function()
- {
- _root.ktooltiptf.removetextfield();
- if(this.iid != "nop")
- {
- clearinterval(this.iid);
- }
- this.iid = setinterval(this,"checkTip",750);
- };
- mouse.addlistener(this);
- };
- delete ko;
- movieclip.prototype.createkcheckbox = function(instancename, depth, initobject)
- {
- this.kattachmovie("KCheckBox",instancename,depth,initobject);
- };
- movieclip.prototype.createklistbox = function(instancename, depth, initobject)
- {
- this.kattachmovie("KListBox",instancename,depth,initobject);
- };
- movieclip.prototype.createkpushbutton = function(instancename, depth, initobject)
- {
- this.kattachmovie("KPushButton",instancename,depth,initobject);
- };
- movieclip.prototype.createkscrollbar = function(instancename, depth, textfield, horizontal)
- {
- if(horizontal)
- {
- this.kattachmovie("KScrollBar",instancename,depth,{object:eval(textfield),controller:"hscroll",minvalue:0,maxvalue:"maxhscroll",visiblesize:"_width",totalsize:"textWidth",horizontal:true,step:10});
- }
- else
- {
- this.kattachmovie("KScrollBar",instancename,depth,{object:eval(textfield),controller:"scroll",minvalue:1,maxvalue:"maxscroll",visiblesize:"visibleSize",totalsize:"totalSize"});
- }
- };
- movieclip.prototype.createkscrollpane = function(instancename, depth, initobject)
- {
- this.kattachmovie("KScrollPane",instancename,depth,initobject);
- };
- object.$protect();
- movieclip.prototype.$protect();
- textfield.prototype.$protect();
- assetpropflags(_global,null,7);
- textfield.prototype.addproperty("visibleSize",textfield.prototype.getvisiblesize,null);
- textfield.prototype.addproperty("totalSize",textfield.prototype.gettotalsize,null);
-